package avicit.bdp.dms.perm.utils.enums;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2021-03-25
 * @类说明：ColumnTypeEnum
 * @修改记录：
 * @注意事项：
 * @主要功能：数据库类型枚举
 */
public enum ColumnTypeEnum {
    TINYIINT("tinyint"),
    FLOAT("float"),
    DECIMAL("decimal"),
    NUMBER("number"),
    SAMLLINT("smallint"),
    INT("int"),
    BIGINT("bigint"),
    DOUBLE("double"),
    BOOLEAN("boolean"),
    MEDIUMINT("mediumint"),
    INT2("int2"),
    INT4("int4"),
    INT8("int8"),
    REAL("real"),
    NUMBERIC("numberic"),
    BYTEA("bytea"),
    FLOAT4("float4"),
    FLOAT8("float8"),
    INTEGER("integer"),
    INT32("int32"),
    INT64("int64"),
    CHAR("char"),
    VARCHAR2("varchar2"),
    NCHAR("nchar"),
    NVARCHAR2("nvarchar2"),
    VARCHAR("varchar"),
    BLOB("blob"),
    CLOB("clob"),
    DATE("date"),
    TIMESTAMP("timestamp"),
    TEXT("text"),
    MEDIUMTEXT("mediumtext"),
    LONGTEXT("longtext"),
    TIME("time"),
    YEAR("year"),
    DATETIME("datetime"),
    STRING("string");

    private String type;

    private ColumnTypeEnum(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public static ColumnTypeEnum getTypeEnum(String type) {
        for (ColumnTypeEnum t : ColumnTypeEnum.values()) {
            if (t.getType().equals(type)) {
                return t;
            }
        }

        return null;
    }
}
